package hqyj.example.seata_user.controller;

import hqyj.example.seata_user.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping("/debit")
    public void debit(@RequestParam("userId") Integer userId,
                      @RequestParam("money") Integer money) {
        userService.debit(userId, money);
    }

}
